<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.sql.*"%>
[<%
 
  System.out.println("idcheck 실행");
 request.setCharacterEncoding("UTF-8");
 String userid = request.getParameter("userid");
 Connection conn = null;
 PreparedStatement pstmt = null;
 ResultSet rs = null;
 
 String jdbcUrl = "jdbc:oracle:thin:@192.168.0.33:1521:orcl2";
 String dbId = "scott";
 String dbPass = "tiger";
 String sql = "";
 
  System.out.println("db 접속");
 try{
  Class.forName("oracle.jdbc.driver.OracleDriver");
  conn = DriverManager.getConnection(jdbcUrl,dbId,dbPass);
  System.out.println(userid);
  sql = "select * from member where userid=?";
  pstmt = conn.prepareStatement(sql);
  		pstmt.setString(1, userid);
  
  rs = pstmt.executeQuery();
  if(!rs.next()){
	   %>
	   {
	    "result":"success"
	   }
	   
	   <%  
  }else{
	   %>
	   {
	    "result":"fault"
	   }   
	   <%  
  }
 
 }catch(Exception e){
  e.printStackTrace();
 }finally{
  if(rs != null)try{rs.close();}catch(SQLException e){}
  if(pstmt != null)try{pstmt.close();}catch(SQLException e){}
  if(conn != null)try{conn.close();}catch(SQLException e){}
 }
%>]